﻿//定位
//透明度控制
//矢量切片-符号设置
//矢量动态地图服务-符号设置
//图层加载、关闭

function LayerOperateBar(id, layerList, operOpt) {
    //属性
    this.id = id;
    this.layerList = layerList;
    this.operOpt = operOpt;
    //方法
    if (typeof this.CreateWidget != "function") {
        LayerOperateBar.prototype.CreateWidget = function () {
            createWidget(this.id, this.layerList, this.operOpt);
        };
    }

    //#region 创建组件

    function createWidget(id, layerList, operOpt) {
        //创建图层操作容器
        var layerOperate_mainform = document.createElement("div");
        layerOperate_mainform.className = "layer-operate-main-form";
        layerOperate_mainform.id = id;
        document.body.appendChild(layerOperate_mainform);
        layerOperate_mainform.onmousemove = function () {
            moveObjByVH(this, 'v');
        }
        var layerOperate_mainform_body = document.createElement("div");
        layerOperate_mainform_body.className = "layer-operate-main-form-body";
        layerOperate_mainform.appendChild(layerOperate_mainform_body);

        //创建图层操作标题栏
        //创建图层操作标题栏-div
        var layerOperate_mainform_header = document.createElement("div");
        layerOperate_mainform_header.className = "layer-operate-main-form-header";
        layerOperate_mainform_body.appendChild(layerOperate_mainform_header);

        //创建图层操作单元icon-i
        var layerOperate_mainform_header_icon = document.createElement("i");
        layerOperate_mainform_header_icon.className = "headericon";
        layerOperate_mainform_header.appendChild(layerOperate_mainform_header_icon);

        //创建图层操作单元标题名称-i
        var layerOperate_mainform_header_text = document.createElement("i");
        layerOperate_mainform_header_text.className = "title";
        layerOperate_mainform_header_text.innerText = "图层控制";
        layerOperate_mainform_header.appendChild(layerOperate_mainform_header_text);

        //创建图层操作单元关闭按钮-i
        var layerOperate_mainform_header_close = document.createElement("i");
        layerOperate_mainform_header_close.className = "closebutton";
        layerOperate_mainform_header_close.onclick = function () {
            $("#" + id).hide();
        }
        layerOperate_mainform_header.appendChild(layerOperate_mainform_header_close);
        //创建图层操作内容栏-div
        var layerOperate_mainform_content = document.createElement("div");
        layerOperate_mainform_content.className = "layer-operate-main-form-contetn";
        layerOperate_mainform_body.appendChild(layerOperate_mainform_content);

        var layerOperate_mainform_content_ul = document.createElement("ul");
        layerOperate_mainform_content.appendChild(layerOperate_mainform_content_ul);

        for (var i = 0; i < layerList.length; i++) {
            var selectLayer = null;
            selectLayer=layerList[i];
            if (selectLayer["NAME"] == "") continue;
            var layerOperate_mainform_content_li = document.createElement("li");
            layerOperate_mainform_content_li.id = id + "-ul-li-" + selectLayer["NAME"]; //
            layerOperate_mainform_content_ul.appendChild(layerOperate_mainform_content_li);
            var layerOperate_main_form_content_node = GetLayerTreeNode(selectLayer);
            selectLayer.ALIAS = selectLayer.ALIAS + "(" + layerOperate_main_form_content_node.mainDiv.pname + ")";
            selectLayer.OPTION = "";
            var lyOperItemBar = new LayerOperateItemBar(selectLayer, "");
            var layerOperItem = lyOperItemBar.CreateLayerOperateItemBar();

            layerOperate_mainform_content_li.appendChild(layerOperItem);

        }
    }

    //#endregion
}
